/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Alvaro
 */
@Entity
@Table(name = "candidate_search_interest")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CandidateSearchInterest.findAll", query = "SELECT c FROM CandidateSearchInterest c"),
    @NamedQuery(name = "CandidateSearchInterest.findByIdCandidateSearchInterest", query = "SELECT c FROM CandidateSearchInterest c WHERE c.idCandidateSearchInterest = :idCandidateSearchInterest"),
    @NamedQuery(name = "CandidateSearchInterest.findByCandidateAndSearch", query = "SELECT c FROM CandidateSearchInterest c WHERE c.candidate = :candidate AND c.search = :search"),
    @NamedQuery(name = "CandidateSearchInterest.findByDate", query = "SELECT c FROM CandidateSearchInterest c WHERE c.date = :date")})
public class CandidateSearchInterest implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_CANDIDATE_SEARCH_INTEREST")
    private Integer idCandidateSearchInterest;
    @Basic(optional = false)
    @NotNull
    @Column(name = "DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date date;
    @JoinColumn(name = "CANDIDATE", referencedColumnName = "ID_CANDIDATE")
    @ManyToOne(optional = false)
    private Candidate candidate;
    @JoinColumn(name = "SEARCH", referencedColumnName = "ID_SEARCH")
    @ManyToOne(optional = false)
    private Search search;

    public CandidateSearchInterest() {
    }

    public CandidateSearchInterest(Integer idCandidateSearchInterest) {
        this.idCandidateSearchInterest = idCandidateSearchInterest;
    }

    public CandidateSearchInterest(Integer idCandidateSearchInterest, Date date) {
        this.idCandidateSearchInterest = idCandidateSearchInterest;
        this.date = date;
    }

    public Integer getIdCandidateSearchInterest() {
        return idCandidateSearchInterest;
    }

    public void setIdCandidateSearchInterest(Integer idCandidateSearchInterest) {
        this.idCandidateSearchInterest = idCandidateSearchInterest;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Candidate getCandidate() {
        return candidate;
    }

    public void setCandidate(Candidate candidate) {
        this.candidate = candidate;
    }

    public Search getSearch() {
        return search;
    }

    public void setSearch(Search search) {
        this.search = search;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCandidateSearchInterest != null ? idCandidateSearchInterest.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CandidateSearchInterest)) {
            return false;
        }
        CandidateSearchInterest other = (CandidateSearchInterest) object;
        if ((this.idCandidateSearchInterest == null && other.idCandidateSearchInterest != null) || (this.idCandidateSearchInterest != null && !this.idCandidateSearchInterest.equals(other.idCandidateSearchInterest))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.CandidateSearchInterest[ idCandidateSearchInterest=" + idCandidateSearchInterest + " ]";
    }
    
}
